<?php

class MesuresActiveRecord extends CActiveRecord {

    private static $dbmesures = null;
 
    protected static function getMesuresDbConnection()
    {
        if (self::dbmesures !== null)
            return self::dbmesures;
        else
        {
            self::$dbmesures = Yii::app()->dbchauffage;
            if (self::dbmesures instanceof CDbConnection)
            {
                self::$dbmesures->setActive(true);
                return self::dbmesures;
            }
            else
                throw new CDbException(Yii::t('yii','Active Record requires a "db" CDbConnection application component.'));
        }
    }
}
